import java.util.ArrayList;
import java.util.List;

public class Client {
    public static void main(String[] args) {
        List<Object> products = new ArrayList<>();


        products.add("G100");
        products.add("G200");
        products.add("G300");
        products.add("G400");

        ProductList productList = new ProductList(products);

        AbstractIterator iterator = productList.createIterator();


        System.out.println("1从前往后遍历李宁羽毛球系列：");
        while (!iterator.isLast()) {
            Object product = iterator.getNextItem();
            System.out.println(product);
            iterator.next();
        }

        //倒序遍历测试
        System.out.println("2从后往前遍历李宁羽毛球系列：");
        iterator = productList.createIterator();
        iterator.setNewIteratorReverse();
        while (!iterator.isFirst()) {
            Object product = iterator.getPreviousItem();
            System.out.println(product);
            iterator.previous();
        }
    }
}